今天要介紹 VSCode 中,可讓註解更清楚的輔助 extension- Better Comments。
Better Comments 安裝步驟:
> 加入以下設定(參考官網)
"better-comments.tags": [
{
"tag": "!",
"color": "#FF2D00",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "?",
"color": "#3498DB",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "//",
"color": "#474747",
"strikethrough": true,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "todo",
"color": "#FF8C00",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "*",
"color": "#98C379",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
}
]
成果
依據設定檔,可依註解類型,選擇不同的符號與顏色。
在撰寫註解時,養成對註解進行分類的習慣,不僅能幫助自己,也能提醒團隊協作者關注需要特別注意的重點。透過這樣的分類,團隊成員可以更快速地理解程式碼意圖與邏輯,進而提升協作效率。此外,每個人都可以根據自己的偏好,在設定檔中自訂顏色與分類標籤,使程式碼更加清晰易讀,強化團隊溝通與專案管理的效果。